<?php
$smarty->configLoad($lang . '/shop.module.php');
$language = parse_ini_file($lang . '/breadcrumb.module.php', true);
$breadcrumb = $language['add_shop'];

if(isset($_POST['submit'])) {
	$main->logAction($_SESSION['id'], 'shop_cat_add_log');
	
	$sql = 'SELECT categoryId FROM '.DB_LOGIN.'.aionshop_categories';
	$dbh = $connection->prepare($sql);
	$dbh->execute();
	$num = $dbh->rowCount();
	
	$sql = 'INSERT INTO '.DB_LOGIN.'.aionshop_categories (categoryId, categoryName) VALUES (:id, :catname)';
	$dbh = $connection->prepare($sql);
	$dbh->bindValue(':id', $num+1);
	$dbh->bindValue(':catname', $_POST['title']);
	$dbh->execute();
	$main->jqmodal('addet');
	echo '<meta http-equiv="refresh" content="5; URL=index.php?mod=shop">';
	
}

$template = 'shop/add.tpl';
?>